<template>
	<view>
		<view class="srarchLists" v-for="(item, index) in listDatas" :key="index" @click="jump(item)">
			<view class="theme">
				<view class="listType">{{item.label==100 ? '文件':(item.label==101 ? '资源' : (item.label==102 ? '课程' :'社区'))}}</view>
				<view class="themeTitle"><u-parse :html="item.title"></u-parse></view>
			</view>
			<view class="listContent"><u-parse :html="item.content"></u-parse></view>
		</view>
		<u-empty mode="search" v-if="listDatas.length === 0"></u-empty>
	</view>
</template>

<script>
	import {
		KmsBbsAllsearch
	} from '@/api/kms/allSearch.js';
	import {
		KmsResourceList
	} from '@/api/kms/course.js';
	export default {
		data(){
			return {
				showBorder: false,
				kmsSearch: '',
				content: '',
				listDatas: []
			}
		},
		computed:{},
		onLoad(option) {
			this.content = option.content
			this.getSearchList()
		},
		onShow() {
			
		},
		watch:{},
		methods:{
			getSearchList(){
				let self = this;
				let params = {
					content: this.content
				}
				KmsBbsAllsearch(params).then(res => {
					self.listDatas = res.data
				})
			},
			searchType(typeNum){
				var type = ''
				if(typeNum === 100){
					type = '文件'
				}else if(typeNum === 101){
					type = '资源'
				}else if(typeNum === 102){
					type = '课程'
				}else if(typeNum === 103){
					type = '社区'
				}
				return type
			},
			//获取上传的url
			jump(item){
				if(item.label==102 || item.label==101 || item.label==100){
					uni.navigateTo({
					    url: '/pages/kmsManagement/kmsFunList/course/courseLog?courseId=' + item.id + '&label='+ item.label,
					});
				}else if(item.label==103){
					uni.navigateTo({
						url: '/pages/kmsManagement/kmsFunList/bbs/bbsDetail?bbsId=' + item.id
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.srarchLists {
		margin: 10px;
		border-bottom: 1px solid #EEEEEE;
	}
	.theme{
		display: flex;
		align-items:center;
		.listType{
			border: 1px solid #2979FF;
			padding: 2px 5px;
			border-radius: 5px;
			color: #FFFFFF;
			background-color: #97D8FA;
		}
		.themeTitle {
			font-size: 18px;
			font-weight: 700;
			margin-left: 10px;
		}
	}
	.listContent {
		margin: 10px 0;
	}
</style>
